package day06.Ti;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Scanner;

public class Ti02Date {
    public static void main(String[] args) throws ParseException {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入日期格式为yyyy年MM月dd日");
        String s=sc.next();
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
        LocalDate parse = LocalDate.parse(s, dtf);
        LocalDate now = LocalDate.now();
        Period between = Period.between(parse, now);
        int years = between.getYears();
        int months = between.getMonths();
        int days = between.getDays();
        if (years>=0&&months>=0&&days>=0){
            System.out.println(parse+"距离现在已经有了"
                    +years+"年" + months + "月" + days + "日");
        }else {
            System.out.println(now + "距离现在还有:" + Math.abs(years) +
                    "年" + Math.abs(months) + "月" + Math.abs(days) + "日");
        }

    }
}
